import * as Blockly from 'blockly/core';
import { Profile } from 'mixly';

const DISPLAY_HUE = 180;


//初始化OLED(SPI)
export const arduino_oled_begin_spi_2 = {
    init: function () {
        this.appendDummyInput()
            .appendField(Blockly.Msg.MIXLY_SETUP + " OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_begin_name");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

//设置光标的位置，OLED将会从此位置开始，向后显示文本或数字
export const arduino_oled_set_cursor = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(" " + Blockly.Msg.MIXLY_STM32_OLED_SET_CURSOR_POSITION);
        this.appendValueInput("set_cursor_x")
            .setCheck(null)
            .appendField("X#");
        this.appendValueInput("set_cursor_y")
            .setCheck(null)
            .appendField("Y#");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_set_font = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(" " + Blockly.Msg.OLED_SET_FONT);
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_STM32_OLED_TINY, "0"], [Blockly.Msg.MIXLY_STM32_OLED_SMALL, "1"], [Blockly.Msg.MIXLY_MID, "2"], [Blockly.Msg.MIXLY_STM32_OLED_BIG, "3"], [Blockly.Msg.MIXLY_STM32_OLED_HUGE, "4"]]), "font_size");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_set_font_color = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(" " + Blockly.Msg.MIXLY_STM32_OLED_SET_FONT_COLOR);
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.COLOUR_WHITE, "WHITE"], [Blockly.Msg.COLOUR_BLACK, "BLACK"], [Blockly.Msg.MIXLY_STM32_OLED_BLACK_ON_WHITE, "BLACK, WHITE"]]), "font_color");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_show_text = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.texttodisplay, "print"], [Blockly.Msg.texttodisplay + "(" + Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP + ")", "println"]]), "show_text_type");
        this.appendValueInput("oled_show_text_auto_linefeed_data")
            .setCheck(null);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_show_num = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MICROBIT_JS_MONITOR_SHOW_NUMBER, "print"], [Blockly.Msg.MIXLY_MICROBIT_JS_MONITOR_SHOW_NUMBER + "(" + Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP + ")", "println"]]), "show_num_type");
        this.appendValueInput("oled_show_num_auto_linefeed_data")
            .setCheck(null);
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MATH_BIN, "BIN"], [Blockly.Msg.MATH_OCT, "OCT"], [Blockly.Msg.MATH_DEC, "DEC"], [Blockly.Msg.MATH_HEX, "HEX"]]), "oled_show_num_auto_linefeed_type");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_set_rotation = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(" " + Blockly.Msg.MIXLY_MICROBIT_monitor)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.blockpy_turtle_rotate + " 0°", "0"], [Blockly.Msg.blockpy_turtle_rotate + " 90°", "1"], [Blockly.Msg.blockpy_turtle_rotate + " 180°", "2"], [Blockly.Msg.blockpy_turtle_rotate + " 270°", "3"]]), "oled_set_rotation_data");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_clear_update_display = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_CLEAR, "clearDisplay"], [Blockly.Msg.OLED_PAGE, "display"]]), "choose_type");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_draw_pixel = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(" " + Blockly.Msg.OLED_DRAWPIXEL);
        this.appendValueInput("oled_draw_pixel_x")
            .setCheck(null)
            .appendField("x");
        this.appendValueInput("oled_draw_pixel_y")
            .setCheck(null)
            .appendField("y");
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.COLOUR_RGB_WHITE, "WHITE"], [Blockly.Msg.COLOUR_BLACK, "BLACK"], [Blockly.Msg.MIXLY_ESP32_TOGGLE, "INVERSE"]]), "oled_draw_pixel_color");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_draw_line = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(" " + Blockly.Msg.OLED_DRAWLINE);
        this.appendValueInput("oled_draw_line_start_x")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_START_X);
        this.appendValueInput("oled_draw_line_start_y")
            .setCheck(null)
            .appendField("y");
        this.appendValueInput("oled_draw_line_end_x")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_END_X);
        this.appendValueInput("oled_draw_line_end_y")
            .setCheck(null)
            .appendField("y");
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.COLOUR_RGB_WHITE, "WHITE"], [Blockly.Msg.COLOUR_BLACK, "BLACK"], [Blockly.Msg.MIXLY_ESP32_TOGGLE, "INVERSE"]]), "oled_draw_line_color");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_draw_line1 = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(Blockly.Msg.OLED_DRAWSTRLINE)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_HOR, "drawFastHLine"], [Blockly.Msg.OLED_VER, "drawFastVLine"]]), "oled_draw_line1_type");
        this.appendValueInput("oled_draw_line_start_x")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_START_X);
        this.appendValueInput("oled_draw_line_start_y")
            .setCheck(null)
            .appendField("y");
        this.appendValueInput("oled_draw_line_length")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_LENGTH);
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.COLOUR_RGB_WHITE, "WHITE"], [Blockly.Msg.COLOUR_BLACK, "BLACK"], [Blockly.Msg.MIXLY_ESP32_TOGGLE, "INVERSE"]]), "oled_draw_line_color");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_draw_rect = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(" " + Blockly.Msg.OLED_DRAW_RECTANGLE)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_HOLLOW, "draw"], [Blockly.Msg.OLED_SOLID, "fill"]]), "oled_draw_rect_type_1");
        this.appendValueInput("oled_draw_rect_x")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_L_U_X);
        this.appendValueInput("oled_draw_rect_y")
            .setCheck(null)
            .appendField("y");
        this.appendValueInput("oled_draw_rect_width")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_WIDTH);
        this.appendValueInput("oled_draw_rect_height")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_HEIGHT);
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.COLOUR_RGB_WHITE, "WHITE"], [Blockly.Msg.COLOUR_BLACK, "BLACK"], [Blockly.Msg.MIXLY_ESP32_TOGGLE, "INVERSE"]]), "oled_draw_rect_color");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_draw_RoundRect = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(" " + Blockly.Msg.OLED_DRAW_RAD_RECTANGLE)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_HOLLOW, "draw"], [Blockly.Msg.OLED_SOLID, "fill"]]), "oled_draw_rect_type_1");
        this.appendValueInput("oled_draw_rect_x")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_L_U_X);
        this.appendValueInput("oled_draw_rect_y")
            .setCheck(null)
            .appendField("y");
        this.appendValueInput("oled_draw_rect_width")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_WIDTH);
        this.appendValueInput("oled_draw_rect_height")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_HEIGHT);
        this.appendValueInput("oled_draw_rect_radius")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_RADIUS);
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.COLOUR_RGB_WHITE, "WHITE"], [Blockly.Msg.COLOUR_BLACK, "BLACK"], [Blockly.Msg.MIXLY_ESP32_TOGGLE, "INVERSE"]]), "oled_draw_rect_color");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_draw_circle = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(" " + Blockly.Msg.OLED_DRAW_CIRCLE)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_HOLLOW, "draw"], [Blockly.Msg.OLED_SOLID, "fill"]]), "oled_draw_circle_type");
        this.appendValueInput("oled_draw_circle_x")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_CENTER_CIRCLE_X);
        this.appendValueInput("oled_draw_circle_y")
            .setCheck(null)
            .appendField("y");
        this.appendValueInput("oled_draw_circle_radius")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_CIRCLE_RADIUS);
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.COLOUR_RGB_WHITE, "WHITE"], [Blockly.Msg.COLOUR_BLACK, "BLACK"], [Blockly.Msg.MIXLY_ESP32_TOGGLE, "INVERSE"]]), "oled_draw_circle_color");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_draw_CircleHelper = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(" " + Blockly.Msg.MIXLY_STM32_OLED_DRAW_ARC + "(" + Blockly.Msg.OLED_HOLLOW + ")");
        this.appendValueInput("oled_draw_circle_x")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_CENTER_CIRCLE_X);
        this.appendValueInput("oled_draw_circle_y")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField("y");
        this.appendValueInput("oled_draw_circle_radius")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_CIRCLE_RADIUS);
        this.appendValueInput("oled_draw_circle_cornername")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.MIXLY_STM32_OLED_ARC);
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.COLOUR_RGB_WHITE, "WHITE"], [Blockly.Msg.COLOUR_BLACK, "BLACK"], [Blockly.Msg.MIXLY_ESP32_TOGGLE, "INVERSE"]]), "oled_draw_color");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_draw_CircleHelper_data = {
    init: function () {
        this.appendDummyInput()
            .appendField(Blockly.Msg.OLED_UP_L)
            .appendField(new Blockly.FieldCheckbox("true"), "LEFT_UP")
            .appendField(new Blockly.FieldCheckbox("true"), "RIGHT_UP")
            .appendField(Blockly.Msg.OLED_UP_R);
        this.appendDummyInput()
            .appendField(Blockly.Msg.OLED_LOW_L)
            .appendField(new Blockly.FieldCheckbox("true"), "LEFT_DOWN")
            .appendField(new Blockly.FieldCheckbox("true"), "RIGHT_DOWN")
            .appendField(Blockly.Msg.OLED_LOW_R);
        this.setOutput(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_fill_CircleHelper = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(" " + Blockly.Msg.MIXLY_STM32_OLED_DRAW_ARC + "(" + Blockly.Msg.OLED_SOLID + ")");
        this.appendValueInput("oled_draw_circle_x")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_CENTER_CIRCLE_X);
        this.appendValueInput("oled_draw_circle_y")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField("y");
        this.appendValueInput("oled_draw_circle_radius")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_CIRCLE_RADIUS);
        this.appendValueInput("oled_draw_circle_cornername")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.MIXLY_STM32_OLED_ARC);
        this.appendValueInput("oled_draw_circle_delta")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_LENGTH);
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.COLOUR_RGB_WHITE, "WHITE"], [Blockly.Msg.COLOUR_BLACK, "BLACK"], [Blockly.Msg.MIXLY_ESP32_TOGGLE, "INVERSE"]]), "oled_draw_color");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_fill_CircleHelper_data = {
    init: function () {
        this.appendDummyInput()
            .appendField(Blockly.Msg.OLED_UP_L + " & " + Blockly.Msg.OLED_LOW_L)
            .appendField(new Blockly.FieldCheckbox("true"), "LEFT");
        this.appendDummyInput()
            .appendField(Blockly.Msg.OLED_UP_R + " & " + Blockly.Msg.OLED_LOW_R)
            .appendField(new Blockly.FieldCheckbox("true"), "RIGHT");
        this.setOutput(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_draw_ellipse = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(" " + Blockly.Msg.OLED_DRAW_ELLIPSE)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_HOLLOW, "false"], [Blockly.Msg.OLED_SOLID, "true"]]), "oled_draw_ellipse_type");
        this.appendValueInput("oled_draw_ellipse_x")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_CENTER_CIRCLE_X);
        this.appendValueInput("oled_draw_ellipse_y")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField("y");
        this.appendValueInput("oled_draw_ellipse_x_radius")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_ELLIPSE_RADIUS_X);
        this.appendValueInput("oled_draw_ellipse_y_radius")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_ELLIPSE_RADIUS_Y);
        this.appendValueInput("oled_draw_ellipse_cornername")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.MIXLY_STM32_OLED_ARC);
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.COLOUR_RGB_WHITE, "WHITE"], [Blockly.Msg.COLOUR_BLACK, "BLACK"], [Blockly.Msg.MIXLY_ESP32_TOGGLE, "INVERSE"]]), "oled_draw_color");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_draw_triangle = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(" " + Blockly.Msg.OLED_DRAW_TRIANGLE)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_HOLLOW, "draw"], [Blockly.Msg.OLED_SOLID, "fill"]]), "oled_draw_triangle_type");
        this.appendValueInput("oled_draw_triangle_x1")
            .setCheck(null)
            .appendField("x1");
        this.appendValueInput("oled_draw_triangle_y1")
            .setCheck(null)
            .appendField("y1");
        this.appendValueInput("oled_draw_triangle_x2")
            .setCheck(null)
            .appendField("x2");
        this.appendValueInput("oled_draw_triangle_y2")
            .setCheck(null)
            .appendField("y2");
        this.appendValueInput("oled_draw_triangle_x3")
            .setCheck(null)
            .appendField("x3");
        this.appendValueInput("oled_draw_triangle_y3")
            .setCheck(null)
            .appendField("y3");
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.COLOUR_RGB_WHITE, "WHITE"], [Blockly.Msg.COLOUR_BLACK, "BLACK"], [Blockly.Msg.MIXLY_ESP32_TOGGLE, "INVERSE"]]), "oled_draw_triangle_color");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_oled_draw_bitmap = {
    init: function () {
        this.appendDummyInput()
            .appendField("OLED")
            .appendField(new Blockly.FieldTextInput("display"), "oled_name")
            .appendField(" " + Blockly.Msg.OLED_BITMAP);
        this.appendValueInput("oled_draw_bitmap_x")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_L_U_X);
        this.appendValueInput("oled_draw_bitmap_y")
            .setCheck(null)
            .appendField("y");
        this.appendValueInput("oled_draw_bitmap_data")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_BITMAP_NAME);
        this.appendValueInput("oled_draw_bitmap_width")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_WIDTH);
        this.appendValueInput("oled_draw_bitmap_height")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_HEIGHT);
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.COLOUR_RGB_WHITE, "WHITE"], [Blockly.Msg.COLOUR_BLACK, "BLACK"], [Blockly.Msg.MIXLY_ESP32_TOGGLE, "INVERSE"]]), "oled_draw_bitmap_color");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_begin_software = {
    init: function () {
        this.appendDummyInput()
            .appendField(Blockly.Msg.MIXLY_SETUP + " TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_STM32_TFT_GREENTAB + "(ST7735)", "INITR_GREENTAB"], [Blockly.Msg.MIXLY_STM32_TFT_REDTAB + "(ST7735)", "INITR_REDTAB"], [Blockly.Msg.MIXLY_STM32_TFT_BLACKTAB + "(ST7735)", "INITR_BLACKTAB"], ["160×80(ST7735)", "INITR_MINI160x80"], ["160×128(ST7789)", "128, 160"], ["240×135(ST7789)", "135, 240"], ["240×240(ST7789)", "240, 240"], ["320×240(ST7789)", "240, 320"], ["480×320(ST7796)", "480×320(ST7796)"]]), "st7735_tab");
        this.appendValueInput("st7735_rst")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(" RST#");
        this.appendValueInput("st7735_cs")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(" CS#");
        this.appendValueInput("st7735_dc")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(" DC#");
        this.appendValueInput("st7735_mosi")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(" MOSI#");
        this.appendValueInput("st7735_sclk")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(" SCLK#");
        this.setInputsInline(false);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_begin_hardware = {
    init: function () {
        this.appendDummyInput()
            .appendField(Blockly.Msg.MIXLY_SETUP + " TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_STM32_TFT_GREENTAB + "(ST7735)", "INITR_GREENTAB"], [Blockly.Msg.MIXLY_STM32_TFT_REDTAB + "(ST7735)", "INITR_REDTAB"], [Blockly.Msg.MIXLY_STM32_TFT_BLACKTAB + "(ST7735)", "INITR_BLACKTAB"], ["160×80(ST7735)", "INITR_MINI160x80"], ["160×128(ST7789)", "128, 160"], ["240×135(ST7789)", "135, 240"], ["240×240(ST7789)", "240, 240"], ["320×240(ST7789)", "240, 320"], ["480×320(ST7796)", "480×320(ST7796)"]]), "st7735_tab");
        this.appendValueInput("st7735_rst")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(" RST#");
        this.appendValueInput("st7735_cs")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(" CS#");
        this.appendValueInput("st7735_dc")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(" DC#");
        this.appendDummyInput()
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(' ' + Blockly.Msg.CONTROLS_FOR_INPUT_WITH)
            .appendField(new Blockly.FieldDropdown([["SPI1", "SPI_1"], ["SPI1(" + Blockly.Msg.MIXLY_STM32_SPI_REMAP + ")", "remap_SPI_1"], ["SPI2", "SPI_2"], ["SPI3", "SPI_3"]]), "spi_type");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

//屏幕背光初始化引脚
export const arduino_st7735_backlight = {
    init: function () {
        this.appendValueInput("st7735_backlight_pin")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_SETTING + " TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(Blockly.Msg.TFT_Brightness + " BL#");
        this.appendValueInput("st7735_backlight_brightness")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_BRIGHTNESS);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_set_rotation = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(" " + Blockly.Msg.MIXLY_MICROBIT_monitor)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.blockpy_turtle_rotate + " 0°", "0"], [Blockly.Msg.blockpy_turtle_rotate + " 90°", "1"], [Blockly.Msg.blockpy_turtle_rotate + " 180°", "2"], [Blockly.Msg.blockpy_turtle_rotate + " 270°", "3"]]), "set_rotation_data");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_set_cursor = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(" " + Blockly.Msg.MIXLY_STM32_OLED_SET_CURSOR_POSITION);
        this.appendValueInput("set_cursor_x")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField("X#");
        this.appendValueInput("set_cursor_y")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField("Y#");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_set_text_size = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(" " + Blockly.Msg.OLED_SET_FONT)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_STM32_OLED_TINY, "0"], [Blockly.Msg.MIXLY_STM32_OLED_SMALL, "1"], [Blockly.Msg.MIXLY_MID, "2"], [Blockly.Msg.MIXLY_STM32_OLED_BIG, "3"], [Blockly.Msg.MIXLY_STM32_OLED_HUGE, "4"]]), "set_text_size_data");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_color = {
    init: function () {
        this.appendDummyInput()
            .appendField(new Blockly.FieldColour("#ff9966"), "st7735_color_type");
        this.setInputsInline(true);
        this.setOutput(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("默认颜色RGB，颜色有误可尝试使用下方颜色积木");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_color_2020_07_20 = {
    init: function () {
        this.appendDummyInput()
            .appendField(new Blockly.FieldColour("#000000"), "st7735_color_type");
        this.setInputsInline(true);
        this.setOutput(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("RGB颜色，颜色错误时使用");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_set_text_screen_color = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(" " + Blockly.Msg.MIXLY_SETTING)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_STM32_TFT_FONT_COLOR, "setTextColor"], [Blockly.Msg.MIXLY_STM32_TFT_BACKGROUND_COLOR, "fillScreen"]]), "choose_type");
        this.appendValueInput("set_text_color_data")
            .setCheck(null);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

//设置字体和字体背景颜色
export const arduino_st7735_set_text_background_color = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(" " + Blockly.Msg.MIXLY_STM32_OLED_SET_FONT_COLOR);
        this.appendValueInput("set_text_color_data")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_TURTLE_WRITE_FONT_NAME);
        this.appendValueInput("set_text_color_background")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_STM32_TFT_BACKGROUND);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

//设置文本综合
export const arduino_st7735_set_text = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(Blockly.Msg.OLEDDISPLAY + " " + Blockly.Msg.TURTLE_POS);
        this.appendValueInput("set_text_x")
            .setCheck(null)
            .appendField("X");
        this.appendValueInput("set_text_y")
            .setCheck(null)
            .appendField("Y");
        this.appendValueInput("set_text_color")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_TURTLE_WRITE_FONT_NAME);
        this.appendValueInput("set_background_color")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_STM32_TFT_BACKGROUND);
        this.appendValueInput("set_text_data")
            .setCheck(null)
            .appendField(Blockly.Msg.HTML_TEXT);
        this.appendDummyInput()
            .appendField(Blockly.Msg.MIXLY_STM32_TFT_SIZE)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_STM32_OLED_TINY, "0"], [Blockly.Msg.MIXLY_STM32_OLED_SMALL, "1"], [Blockly.Msg.MIXLY_MID, "2"], [Blockly.Msg.MIXLY_STM32_OLED_BIG, "3"], [Blockly.Msg.MIXLY_STM32_OLED_HUGE, "4"]]), "set_text_size");
        this.appendDummyInput()
            .appendField(Blockly.Msg.MIXLY_SD_NEWLINE)
            .appendField(new Blockly.FieldCheckbox("false"), "set_text_linebreak");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_show_text = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.texttodisplay, "print"], [Blockly.Msg.texttodisplay + "(" + Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP + ")", "println"]]), "show_text_type");
        this.appendValueInput("st7735_print_data")
            .setCheck(null);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_show_num = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MICROBIT_JS_MONITOR_SHOW_NUMBER, "print"], [Blockly.Msg.MIXLY_MICROBIT_JS_MONITOR_SHOW_NUMBER + "(" + Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP + ")", "println"]]), "show_num_type");
        this.appendValueInput("st7735_print_data")
            .setCheck(null);
        this.appendDummyInput()
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MATH_BIN, "BIN"], [Blockly.Msg.MATH_OCT, "OCT"], [Blockly.Msg.MATH_DEC, "DEC"], [Blockly.Msg.MATH_HEX, "HEX"]]), "st7735_print_type");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_draw_pixel = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(" " + Blockly.Msg.OLED_DRAWPIXEL);
        this.appendValueInput("st7735_draw_pixel_x")
            .setCheck(null)
            .appendField("x");
        this.appendValueInput("st7735_draw_pixel_y")
            .setCheck(null)
            .appendField("y");
        this.appendValueInput("st7735_draw_pixel_color")
            .setCheck(null)
            .appendField(Blockly.Msg.HTML_COLOUR);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_draw_line = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(" " + Blockly.Msg.OLED_DRAWLINE);
        this.appendValueInput("st7735_draw_pixel_start_x")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_START_X);
        this.appendValueInput("st7735_draw_pixel_start_y")
            .setCheck(null)
            .appendField("y");
        this.appendValueInput("st7735_draw_pixel_end_x")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_END_X);
        this.appendValueInput("st7735_draw_pixel_end_y")
            .setCheck(null)
            .appendField("y");
        this.appendValueInput("st7735_draw_pixel_color")
            .setCheck(null)
            .appendField(Blockly.Msg.HTML_COLOUR);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_draw_line1 = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(Blockly.Msg.OLED_DRAWSTRLINE)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_HOR, "drawFastHLine"], [Blockly.Msg.OLED_VER, "drawFastVLine"]]), "st7735_draw_line1_type");
        this.appendValueInput("st7735_draw_pixel_start_x")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_START_X);
        this.appendValueInput("st7735_draw_pixel_start_y")
            .setCheck(null)
            .appendField("y");
        this.appendValueInput("st7735_draw_pixel_length")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_LENGTH);
        this.appendValueInput("st7735_draw_pixel_color")
            .setCheck(null)
            .appendField(Blockly.Msg.HTML_COLOUR);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_draw_rect = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(" " + Blockly.Msg.OLED_DRAW_RECTANGLE)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_HOLLOW, "draw"], [Blockly.Msg.OLED_SOLID, "fill"]]), "st7735_draw_rect_type_1");
        this.appendValueInput("st7735_draw_rect_x")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_L_U_X);
        this.appendValueInput("st7735_draw_rect_y")
            .setCheck(null)
            .appendField("y");
        this.appendValueInput("st7735_draw_rect_width")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_WIDTH);
        this.appendValueInput("st7735_draw_rect_hight")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_HEIGHT);
        this.appendValueInput("st7735_draw_rect_color")
            .setCheck(null)
            .appendField(Blockly.Msg.HTML_COLOUR);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_draw_Roundrect = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(" " + Blockly.Msg.OLED_DRAW_RAD_RECTANGLE)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_HOLLOW, "draw"], [Blockly.Msg.OLED_SOLID, "fill"]]), "st7735_draw_rect_type_1");
        this.appendValueInput("st7735_draw_rect_x")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_L_U_X);
        this.appendValueInput("st7735_draw_rect_y")
            .setCheck(null)
            .appendField("y");
        this.appendValueInput("st7735_draw_rect_width")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_WIDTH);
        this.appendValueInput("st7735_draw_rect_hight")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_HEIGHT);
        this.appendValueInput("st7735_draw_rect_radius")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_CIRCLE_RADIUS);
        this.appendValueInput("st7735_draw_rect_color")
            .setCheck(null)
            .appendField(Blockly.Msg.HTML_COLOUR);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_draw_circle = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(" " + Blockly.Msg.OLED_DRAW_CIRCLE)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_HOLLOW, "draw"], [Blockly.Msg.OLED_SOLID, "fill"]]), "oled_draw_circle_type");
        this.appendValueInput("st7735_draw_circle_x")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_CENTER_CIRCLE_X);
        this.appendValueInput("st7735_draw_circle_y")
            .setCheck(null)
            .appendField("y");
        this.appendValueInput("st7735_draw_circle_radius")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_CIRCLE_RADIUS);
        this.appendValueInput("st7735_draw_circle_color")
            .setCheck(null)
            .appendField(Blockly.Msg.HTML_COLOUR);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_draw_CircleHelper = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(" " + Blockly.Msg.MIXLY_STM32_OLED_DRAW_ARC + "(" + Blockly.Msg.OLED_HOLLOW + ")");
        this.appendValueInput("st7735_draw_circle_x")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_CENTER_CIRCLE_X);
        this.appendValueInput("st7735_draw_circle_y")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField("y");
        this.appendValueInput("st7735_draw_circle_radius")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_CIRCLE_RADIUS);
        this.appendValueInput("st7735_draw_circle_cornername")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.MIXLY_STM32_OLED_ARC);
        this.appendValueInput("st7735_draw_circle_color")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.HTML_COLOUR);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_fill_CircleHelper = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(" " + Blockly.Msg.MIXLY_STM32_OLED_DRAW_ARC + "(" + Blockly.Msg.OLED_SOLID + ")");
        this.appendValueInput("st7735_draw_circle_x")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_CENTER_CIRCLE_X);
        this.appendValueInput("st7735_draw_circle_y")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField("y");
        this.appendValueInput("st7735_draw_circle_radius")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_CIRCLE_RADIUS);
        this.appendValueInput("st7735_draw_circle_cornername")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.MIXLY_STM32_OLED_ARC);
        this.appendValueInput("st7735_draw_circle_delta")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_LENGTH);
        this.appendValueInput("st7735_draw_circle_color")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.HTML_COLOUR);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_draw_ellipse = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(" " + Blockly.Msg.OLED_DRAW_ELLIPSE)
            .appendField(new Blockly.FieldDropdown([["空心", "false"], ["实心", "true"]]), "st7735_draw_ellipse_type");
        this.appendValueInput("st7735_draw_ellipse_x")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_CENTER_CIRCLE_X);
        this.appendValueInput("st7735_draw_ellipse_y")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField("y");
        this.appendValueInput("st7735_draw_ellipse_x_radius")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_ELLIPSE_RADIUS_X);
        this.appendValueInput("st7735_draw_ellipse_y_radius")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.OLED_ELLIPSE_RADIUS_Y);
        this.appendValueInput("st7735_draw_ellipse_cornername")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.MIXLY_STM32_OLED_ARC);
        this.appendValueInput("st7735_draw_ellipse_color")
            .setCheck(null)
            .setAlign(Blockly.ALIGN_RIGHT)
            .appendField(Blockly.Msg.HTML_COLOUR);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_draw_triangle = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "st7735_name")
            .appendField(" " + Blockly.Msg.OLED_DRAW_TRIANGLE)
            .appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_HOLLOW, "draw"], [Blockly.Msg.OLED_SOLID, "fill"]]), "st7735_draw_triangle_type");
        this.appendValueInput("st7735_draw_triangle_x1")
            .setCheck(null)
            .appendField("x1#");
        this.appendValueInput("st7735_draw_triangle_y1")
            .setCheck(null)
            .appendField("y1#");
        this.appendValueInput("st7735_draw_triangle_x2")
            .setCheck(null)
            .appendField("x2#");
        this.appendValueInput("st7735_draw_triangle_y2")
            .setCheck(null)
            .appendField("y2#");
        this.appendValueInput("st7735_draw_triangle_x3")
            .setCheck(null)
            .appendField("x3#");
        this.appendValueInput("st7735_draw_triangle_y3")
            .setCheck(null)
            .appendField("y3#");
        this.appendValueInput("st7735_draw_triangle_color")
            .setCheck(null)
            .appendField(Blockly.Msg.HTML_COLOUR);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};

export const arduino_st7735_draw_bitmap = {
    init: function () {
        this.appendDummyInput()
            .appendField("TFT")
            .appendField(new Blockly.FieldTextInput("tft"), "oled_name")
            .appendField(" " + Blockly.Msg.OLED_BITMAP);
        this.appendValueInput("oled_draw_bitmap_x")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_L_U_X);
        this.appendValueInput("oled_draw_bitmap_y")
            .setCheck(null)
            .appendField("y");
        this.appendValueInput("oled_draw_bitmap_data")
            .setCheck(null)
            .appendField(Blockly.Msg.OLED_BITMAP_NAME);
        this.appendValueInput("oled_draw_bitmap_width")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_WIDTH);
        this.appendValueInput("oled_draw_bitmap_height")
            .setCheck(null)
            .appendField(Blockly.Msg.MIXLY_HEIGHT);
        this.appendValueInput("st7735_color")
            .setCheck(null)
            .appendField(Blockly.Msg.HTML_COLOUR);
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(DISPLAY_HUE);
        this.setTooltip("");
        this.setHelpUrl("");
    }
};